import request from '@/utils/request'
const api_url='/system/role'

/**
 * 条件分页查询
 * @param currentPage 当前页
 * @param pageSize 当前页页面显示的数量
 * @param searchCondition 搜索条件
 * @returns {*}
 */
export function getRolePageListApi(currentPage, pageSize, searchCondition) {
  return request({
    url: `${api_url}/page/${currentPage}/${pageSize}`,
    method: 'post',
    //参数
    data:searchCondition
  })
}

/**
 * 保存新角色
 * @param role
 * @returns {*}
 */
export function saveNewRoleApi(role) {
  return request({
    url: `${api_url}/save`,
    method: 'post',
    //参数
    data:role
  })
}

/**
 * 逻辑删除
 * @param id
 * @returns {*}
 */
export function deleteRoleApi(id) {
  return request({
    url: `${api_url}/remove/${id}`,
    method: 'delete',
  })
}

/**
 * 根据id批量删除
 * @param ids id列表
 * @returns {*}
 */
export function batchDeleteRoleApi(ids) {
  return request({
    url: `${api_url}/batchRemove`,
    method: 'delete',
    data:ids
  })
}

/**
 * 根据id获得单个角色信息
 * @param roleId
 * @returns {AxiosPromise}
 */
export function getSingleId(roleId) {
  return request({
    url: `${api_url}/get/${roleId}`,
    method: 'get',
  })
}

/**
 * 查询全部角色
 * @returns {AxiosPromise}
 */
export function getAllRoleApi() {
  return request({
    url: `${api_url}/findAll`,
    method: 'get',
  })
}

